package com.atguigu.admin.mapper;

import com.atguigu.admin.bean.City;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

/**
 * @author anan
 * @create 2021-09-02 18:37
 */
@Mapper
public interface CityMapper {

    @Select("select * from city where id=#{id}")
    public City getById(long id);

    @Insert("INSERT INTO city(`name`,`state`,`country`) VALUES(#{name}, #{state}, #{country})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    public void insertCity(City city);
}
